package day05.JavaCodePractice;
import java.util.Arrays;
public class MaxArrayPractice {
    public static void main(String[] args) {

        int[] arr1 = new int[10];
        for (int i = 0; i < arr1.length; i++) {
            arr1[i] = (int) (Math.random() * 1000);
            System.out.println(arr1[i]);
        }

        int min1 = arr1[0];
        int max1 = arr1[0];
        for (int i = 1; i < arr1.length; i++) {
            if (arr1[i] > max1) {
                max1 = arr1[i];
            } else if (arr1[i] < min1) {
                min1 = arr1[i];
            }
        }
        System.out.println("数组的最大值为: " + max1);
        System.out.println("数组的最小值为:" + min1);

        int[] arr2 = {10, 20, 30, 40, 50};
        int[] arr3 = new int[8];    //0, 0, 0, 20, 30, 40, 50, 0
        System.arraycopy(arr2, 1, arr3, 3, arr2.length - 1);

        for (int i = 0; i < arr3.length; i++) {
            System.out.println(arr3[i]);
        }
    }
}
